import { TIME_STAMP, TOKEN_TIMEOUT_VALUE } from '@/constant'
import { getItem, setItem } from '@/utils/storage'
// 获取时间戳
export function getTimeStamp() {
  return getItem(TIME_STAMP)
}
// 设置时间戳
export function setTimeStamp() {
  return setItem(TIME_STAMP, Date.now())
}

// 判断是否超时
export function isTokenTimeout() {
  const currentTime = Date.now()
  const setTime = getTimeStamp()
  return currentTime - setTime > TOKEN_TIMEOUT_VALUE
}
